#!/usr/bin/env bash

set -eu -o pipefail -x

: ${CONTINUOUS_INTEGRATION=}

progressFlag=""
if [ "$CONTINUOUS_INTEGRATION" == "true" ]; then progressFlag="--progress=plain"; fi

cacheOnlyFlag=""
if ! docker build --help 2>&1 | grep buildx >/dev/null; then cacheOnlyFlag="-o type=cacheonly"; fi

export DOCKER_BUILDKIT=1
docker build $progressFlag $cacheOnlyFlag -f ./hack/dockerfiles/lint.Dockerfile .
